package com.nondo.rdp.stock.domain;

import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * 模拟炒股卖出
 */
@Entity
@Table(name = "stock_simulate_log")
public class SimulateLog extends BaseEntity {
    public final static int TYPE_BUY = 0;//买入类型
    public final static int TYPE_SALE = 1;//卖出类型

    private Long id;    //自增ID
    private User user; //用户
    private String code;//股票代码
    private String name; //股票名字
    private Date createTime;//买入卖出时间
    private double money;//买入卖出价格
    private int num;//买入卖出股票数量
    private double totalMoney;//买入卖出总价格
    private int type;//0=买入,1=卖出
    private SimulateBuy simulateBuy;//关联的买入股票情况
    private Date searchEndTime; //用于数据库搜索的结束时间
    private String showTime;//展示时间

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "uid")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public double getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(double totalMoney) {
        this.totalMoney = totalMoney;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public SimulateBuy getSimulateBuy() {
        return simulateBuy;
    }

    public void setSimulateBuy(SimulateBuy simulateBuy) {
        this.simulateBuy = simulateBuy;
    }

    @Transient
    public Date getSearchEndTime() {
        return searchEndTime;
    }

    public void setSearchEndTime(Date searchEndTime) {
        this.searchEndTime = searchEndTime;
    }

    @Transient
    public String getShowTime() {
        return showTime;
    }

    public void setShowTime(String showTime) {
        this.showTime = showTime;
    }
}
